﻿using System;
using System.Collections.Generic;
using STeaL.Functional;

namespace STeaL.Algorithm {
  public static partial class IListExtensions {
#region find_if
    public static int find_if<T>(this IList<T> list, int first, int last, Func<T,bool> pred) {
      while ( first != last && !pred(list[first]) ) ++first;
      return first;
    }

    public static int find_if<T>(this IList<T> list, Func<T,bool> pred) {
      return find_if(list, 0, list.Count, pred);
    }

#endregion
  }
}
